// pages/lbtest/lbtest.js
const allsubject = wx.getStorageSync("subject")
Page({

  /**
   * 页面的初始数据
   */
  data: {
    status: {},
    id: "",//题型id
    items:"",//科目
    count: {},
    check: {},
    dir: {}
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    this.judge(options.id)
  },
  bindDetail:function(e){
    let id = e.currentTarget.dataset.status;
    console.log(this.data.items[id].type)
    if (this.data.items[id].type==1){   //1代表选择题，参考app.js注释
      wx.navigateTo({
        url: `/pages/title/title?id=${this.data.items[id].id}`,
      })
    }
    if (this.data.items[id].type == 2){
      wx.navigateTo({
        url: `/pages/yuedu/yuedu?id=${this.data.items[id].id}`,
      })
    }
    if (this.data.items[id].type == 3) {
      wx.navigateTo({
        url: `/pages/dati/dati?id=${this.data.items[id].id}`,
      })
    }
    if (this.data.items[id].type == 4) {
      wx.navigateTo({
        url: `/pages/tupian/tupian?id=${this.data.items[id].id}`,
      })
    }
    if (this.data.items[id].type == 5) {
      wx.navigateTo({
        url: `/pages/tiankong/tiankong?id=${this.data.items[id].id}`,
      })
    }
    if (this.data.items[id].type == 6) {
      wx.navigateTo({
        url: `/pages/bianxi/bianxi?id=${this.data.items[id].id}`,
      })
    }
    if (this.data.items[id].type == 7) {
      wx.navigateTo({
        url: `/pages/xuana/xuana?id=${this.data.items[id].id}`,
      })
    }
    if (this.data.items[id].type == 8) {
      wx.navigateTo({
        url: `/pages/xuanx/xuanx?id=${this.data.items[id].id}`,
      })
    }
    if (this.data.items[id].type == 9) {
      wx.navigateTo({
        url: `/pages/xuanb/xuanb?id=${this.data.items[id].id}`,
      })
    }
    if (this.data.items[id].type == 10) {
      wx.navigateTo({
        url: `/pages/sxjdt/sxjdt?id=${this.data.items[id].id}`,
      })
    }
    console.log(id)
  },
  //判断科目
  judge:function(e){
    if (e == "gqbyw") {
      this.setData({
        items: allsubject.gqbyw,
      })
    }
    if(e == "gqbsx1"){
      this.setData({
        items: allsubject.gqbsx1,
      })
    }
    if (e == "gqbsx2") {
      this.setData({
        items: allsubject.gqbsx2,
      })
    }
    if (e == "gqbyy") {
      this.setData({
        items: allsubject.gqbyy,
      })
    }
    if (e == "gqblh") {
      this.setData({
        items: allsubject.gqblh,
      })
    }
    if (e == "gqbsd") {
      this.setData({
        items: allsubject.gqbsd,
      })
    }
    if (e == "gqzsx1") {
      this.setData({
        items: allsubject.gqzsx1,
      })
    }
    if (e == "gqzsx2") {
      this.setData({
        items: allsubject.gqzsx2,
      })
    }
    if (e == "gqzyy") {
      this.setData({
        items: allsubject.gqzyy,
      })
    }
    if (e == "gqzyw") {
      this.setData({
        items: allsubject.gqzyw,
      })
    }
    if (e == "zsbsx1"){
      this.setData({
        items: allsubject.zsbsx1,
      })
    }
    if (e == "zsbsx2") {
      this.setData({
        items: allsubject.zsbsx2,
      })
    }
    if (e == "zsbyy") {
      this.setData({
        items: allsubject.zsbyy,
      })
    }
    if (e == "zsbzz") {
      this.setData({
        items: allsubject.zsbzz,
      })
    }
    if (e == "zsbyxzh") {
      this.setData({
        items: allsubject.zsbyxzh,
      })
    }
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})
// 科目参照表
// 0 高起本语文基础选择题
// 1 高起本英语选择题